#lang racket

(define (smallest-divisor n) 
  (find-divisor n 2))

(define (devides? a b)
  (= (remainder b a) 0))

(define (square x) (* x x))

(define (find-divisor n test-divisor)
  (cond ((> (square test-divisor) n) n)
        ((devides? test-divisor n) test-divisor)
        (else (find-divisor n (+ test-divisor 1)))))

(smallest-divisor 199)

(smallest-divisor 1999)

(smallest-divisor 19999)